package com.example.admin.controller;

import com.example.publice.config.DbConfig;
import com.example.publice.config.GenerConfig;
import com.example.publice.generator.Generator;
import com.example.publice.generator.entity.GeneratorInfo;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/test")
public class TestController {


    @Autowired
    private DbConfig dbConfig;
    @Autowired
    private GenerConfig generConfig;


    @GetMapping
    public void init(@ApiParam(value = "desc of param", required = true) String dd) {
        GeneratorInfo generatorInfo = new GeneratorInfo();
        generatorInfo.setTableName("gen_table_column");
        generatorInfo.setPackageName(generConfig.getPackageName());
        generatorInfo.setModuleName("admin");
        Generator generator = Generator.builder(generConfig, dbConfig, generatorInfo);
        generator.execute();

    }
}
